<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let str = window.location.search.substr(1);

        let arr = str.split('&');

        let obj = {};
        arr.forEach(item=>{
            let atr= item.split('=')
            //这里注意下中括号,我服了
            //这里不是用的缩略,用的是键名使用变量
            obj[atr[0]] = atr[1];
            // obj.atr[0].substr(1,-1) = atr[1]//不能用这种写法,因为atr[0]是一个字符串,不是一个名字
        })
        console.log(obj);

        
    </script>
</body>
</html>